﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
        window.onload = function () {
            window.chrome.webview.addEventListener('message', arg => {
                var p = document.getElementById('p2Text');
                p.innerHTML = arg.data;
                //alert(arg.data);
            });
        }

        function ShowMessage() {
            //alert("你点我啊");
            window.chrome.webview.postMessage("Hello from HTML!");
        }
        function Show(msg) {
            //alert(msg);
            var p = document.getElementById('pText');
            p.innerHTML = msg;
            document.querySelector('.pText').innerHTML = msg;
        }
    </script>
</head>
<body>
    <div>
        <p id="pText">dsf</p>
        <p id="p2Text">dsf</p>
        <button id="btnClick" onclick="ShowMessage()">点击</button>
    </div>
</body>
</html>